from PyQt5.Qt import *
import sys
from teach.page4.p3_QListView import Window as leftView



class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("布局管理-初始QLayout")
        self.resize(1200,800)
        self.addLabels()


    def addLabels(self):
        # lb1 = QLabel('区域1',self)
        # lb1.setFixedWidth(320)
        # lb1.setStyleSheet("""
        # background-color:red;
        # """)
        lb1 = leftView()
        lb2 = QLabel('区域2', self)
        lb2.setStyleSheet("""
              background-color:green;
              """)
        layout = QHBoxLayout() #横向布局
        layout.setSpacing(16)
        layoutLeft = QVBoxLayout()  #左边的
        layoutRight= QVBoxLayout()  #左边的

        self.setLayout(layout)
        layout.addLayout(layoutLeft)
        layout.addLayout(layoutRight)
        layoutLeft.addWidget(lb1)
        layoutRight.addWidget(lb2)


if __name__=='__main__':
    app = QApplication(sys.argv)
    w = Window()
    w.show()
    sys.exit(app.exec_())